package com.ebuy.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

public class UploadUtil {
	
	/**
	 * 通过UUID设置文件名
	 * @return
	 */
	public static String getFileNameByUUID(){
		String uuid = UUID.randomUUID().toString();
		uuid = uuid.replace("-", "");
		return uuid;
	}
	
	/**
	 * 根据当前时间设置文件名
	 * @return
	 */
	public static String getFileNameByDate(){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
		String now = sdf.format(new Date());
		return now;
	}
	
	public static void main(String[] args) {
		System.out.println(getFileNameByUUID());
	}
}
